#ifndef CLUSTER_H
#define CLUSTER_H

#include "Layering.h"
#include "Pile.h"
#include "Tree_Node.h"
#include "ID_Generator.h"

//
// A subset of a pile of items
// Also implements tree nodes, and layers.
//
class Cluster : public Layering, Tree_Node {
public:
    Cluster(const Pile *pile, int color);

    void init(int color);
    void append(Cluster *other);

    void extend_labels(int last_digit);
    void write(std::ostream& os);

    static void read_from_ID_file(std::string& filename,
                                  Pile *items,
                                  std::vector<Cluster*>& clusters);

    int ID;
    Pile *items;

    static ID_Generator IDs;
};

#endif
